package jgo.plugins.jdbc;

import javax.sql.DataSource;
import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import jgo.JGo;
import jgo.Plugin;

public class MySqlPlugin extends Plugin {
    public static final MySqlPlugin instance = new MySqlPlugin();
    public DataSource dataSource;

    private MySqlPlugin() {}

    @Override
    public void init(JGo gin) {
        HikariConfig config = new HikariConfig();
        config.setJdbcUrl(gin.getConfig("mysql", "jdbcUrl"));
        config.setUsername(gin.getConfig("mysql", "username"));
        config.setPassword(gin.getConfig("mysql", "password"));
        dataSource = new HikariDataSource(config);
    }

}